<?php

namespace App\Http\Controllers\Admin;

use App\Models\System as SystemInfo;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class System extends Controller
{
    //展示
    public function system ()
    {
        if (request()->isMethod('post')) {
            $data = request()->only(['webname','copyright']);
            $result = (new SystemInfo)->system($data);
            if ($result == 1) {
                $msg = [
                    'code' => 1,
                    'msg' => "保存成功",
                    'url' => url('admin/system'),
                ];
            } else {
                $msg = [
                    'code' => 0,
                    'msg' => $result,
                ];
            }
            return $msg;
        }
        $system = (new SystemInfo)->first();
        return view('admin.system.system',['system'=>$system]);
    }
}
